/**
 * 停止刷新
 * @author baldhead
 */
const onPullDownRefresh=()=> {
	console.log('refresh');
	setTimeout(function () {
		uni.stopPullDownRefresh();
	}, 1000);
}
const gotoView=(url)=>{
	uni.navigateTo({
		url
	})
}
const backPage=(number)=>{
	uni.navigateBack({
		delta:number
	})
}
const prePage = ()=>{
	let pages = getCurrentPages();
	let prePage = pages[pages.length - 2];
	// #ifdef H5
	return prePage;
	// #endif
	return prePage.$vm;
}

//弹窗
const msg = (title, duration=1500, mask=false, icon='none')=>{
	//统一提示方便全局修改
	if(Boolean(title) === false){
		return;
	}
	uni.showToast({
		title,
		duration,
		mask,
		icon
	});
}
//注册定义的方法
export const commonFunc={
	onPullDownRefresh,gotoView,backPage,msg,prePage
}